<?php
namespace app\index\controller;

use app\common\controller\Base;
use app\ux\System as Sys;

error_reporting(E_ALL ^ E_DEPRECATED);

/**
 * 系统信息
 */
class System extends Base
{

    private $conn;

    /**
     * 控制器初始化
     * @return   void
     */
    public function _initialize()
    {
        //基类授权
        //
        parent::_initialize();
    }
    /**
     * 获取信息
     */
    public function sysInfo()
    {

        try {
            $system                  = new Sys();
            $sysinfo                 = [];
            $sysinfo['phpversion']   = $system->phpVersion();
            $sysinfo['mysqlversion'] = $system->dbVersion();
            $sysinfo['webserver']    = $system->webServer();
            $sysinfo['osname']       = $system->osName();
            $sysinfo['serverip']     = $system->serverIp();

            $output = array('success' => true, 'msg' => "ok", 'data' => $sysinfo);
            return json($output);

        } catch (\Exception $e) {
            throw new \think\Exception('异常消息:' . $e->getMessage());
        }
    }
}
